//
//  MovieTableView.m
//  往昔
//
//  Created by mac on 16/2/24.
//  Copyright © 2016年 干晨威. All rights reserved.
//

#import "MovieTableView.h"
#import "MovieTableViewCell.h"

#define movieCell @"movieCell"

@implementation MovieTableView

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        _mutData = [[NSMutableArray alloc] init];
        
        self.backgroundColor = [UIColor colorWithRed:229.0 / 255 green:229.0 / 255 blue:229.0 / 255 alpha:1];
        
        self.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        self.delegate = self;
        self.dataSource = self;
        
        [self registerClass:[MovieTableViewCell class] forCellReuseIdentifier:movieCell];
        
    }
    return self;
}

#pragma -mark -UITableView delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    //    NSLog(@"%ld", self.data.count);
    return self.mutData.count;
//    return 20;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return kPicHeight + 2 + kVerticalSpace;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    MovieTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:movieCell forIndexPath:indexPath];
    
    cell.data = self.mutData[indexPath.row];
    cell.backgroundColor = [UIColor clearColor];
    
    return cell;
}

@end
